local bozheng = fk.CreateSkill {
  name = "lingling__bozheng",
  tags = { Skill.Limited },
}

Fk:loadTranslationTable{
  ["lingling__bozheng"] = "拨正",
  [":lingling__bozheng"] = "限定技，当一名角色翻至背面时，你可以令其翻至正面并摸两张牌。",

  ["#lingling__bozheng-invoke"] = "拨正：是否令 %dest 翻至正面并摸两张牌？",

  ["$lingling__bozheng1"] = "拨乱世，反诸正，君王者当如是。",
  ["$lingling__bozheng2"] = "至东都，赦天下，神龙易位，再开唐统。",
}

bozheng:addEffect(fk.BeforeTurnOver, {
  anim_type = "support",
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(bozheng.name) and
      not target.dead and target.faceup and
      player:usedSkillTimes(bozheng.name, Player.HistoryGame) == 0
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    if room:askToSkillInvoke(player, {
      skill_name = bozheng.name,
      prompt = "#lingling__bozheng-invoke::"..target.id,
    }) then
      event:setCostData(self, {tos = {target}})
      return true
    end
  end,
  on_use = function (self, event, target, player, data)
    data.prevented = true
    target:drawCards(2, bozheng.name)
  end,
})

return bozheng
